# Makefile for NASM project
BUILD:=./build
IMAGE:= "hd.img"

all: ${BUILD}/boot/boot.bin
	rm -f $(IMAGE)
	bximage -q -hd=16 -func=create -sectsize=512 -imgmode=flat $(IMAGE)
	dd if=${BUILD}/boot/boot.bin of=hd.img bs=512 seek=0 count=1 conv=notrunc

${BUILD}/boot/boot.bin: src/boot/boot.asm
	mkdir -p ${BUILD}
	mkdir -p ${BUILD}/boot
	nasm $< -o $@ -l ${BUILD}/boot/boot.lst

clean:
	rm -f $(IMAGE)
	rm -rf ${BUILD}

bochs: all
	bochs -q -f bochsrc

.PHONY: all clean bochs